package com.wrupple.vegetate.server.service;

import javax.servlet.http.HttpServletRequest;

import com.wrupple.vegetate.domain.VegetateToken;
import com.wrupple.vegetate.server.domain.SimpleVegetateToken;

public class UrlVegetateTokenizer implements VegetateRequestTokenizer {

	@Override
	public VegetateToken[] getRequestTokens(HttpServletRequest request) {
		String path = request.getRequestURI();
		String[] tokens = path.split("/");
		VegetateToken temp ;
		VegetateToken[] regreso = new VegetateToken[tokens.length];
		int i = 0;
		for(String token: tokens){
			if(token.trim().isEmpty()){
				
			}else{
				temp = new SimpleVegetateToken(token);
				regreso[i]=temp;
				i++;
			}
			
		}
		return regreso;
	}

}
